import PageLayout from './components/PageLayout';
import '@arco-design/web-react/dist/css/arco.css';
import './App.css';
import { GlobalContext } from './context';
import { Route, Routes } from 'react-router-dom';
import Home from './pages/Home';
import Demo from './pages/Demo';
import Login from './pages/Login';
import RouterGurad from './RouterGurad';
import defineRouter from './router';
import Abnormal from './components/NotFound';

const routes = [
  // 首页
  {
    path: '/login',
    element: <Login></Login>,
    // auth 是否需要权限校验
    auth: false,
  },
  {
    path: '/',
    element: <PageLayout></PageLayout>,
    // auth 是否需要权限校验
    auth: true,
    children: [
      {
        path: 'about',
        element: <Demo></Demo>,
        // auth 是否需要权限校验
        auth: true,
      },
      {
        path: 'demo',
        element: <Home></Home>,
        // auth 是否需要权限校验
        auth: true,
      },
    ],
  },
  {
    path: '404',
    element: <Abnormal></Abnormal>,
    auth: false,
  },
];

function App() {
  const isLogin = false;

  return (
    <>
      <RouterGurad routers={routes}></RouterGurad>
    </>
  );
}

export default App;
